package com.woniuxy.qiantai.utils;

import com.github.pagehelper.PageInfo;

import java.util.List;

public class List2PageUtils {
    public PageInfo pageInfo(List list, List innerList ,PageInfo pageInfo,Integer currentPage,
                             Integer pageSize){
        pageInfo.setTotal(list.size());
        pageInfo.setPageNum(currentPage);
        pageInfo.setPageSize(pageSize);
        for (int i = 0; (i < (list.size() - pageSize * currentPage >= 0 ? pageSize :
                list.size() % pageSize)); i++) {
            innerList.add(list.get((currentPage - 1) * pageSize + i));
        }
        pageInfo.setList(innerList);
        return pageInfo;
    }
}
